<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function star(uname, age) {
            this.uname = uname;
            this.age = age;
        }
        star.prototype.sing = function() {
            console.log("我会唱歌");
        }
        var ldh = new star("刘德华", 18);
        var zxy = new star("张学友", 19);
        ldh.sing();
        console.log(ldh);
        // __proto__对象原型和原型对象prototype是等价的，都表示对象的原型
        console.log(ldh.__proto__ === star.prototype); //true
    </script>
</body>

</html>